<?php 
defined('_JEXEC') or die('Restricted access');

$lang =& JFactory::getLanguage();
//$template_dir = $this->baseurl.'/templates/mwc_careitec/assets/';
$template_dir = '/templates/mwc_careitec/assets/';
jimport('mylibs.function');
jimport('mylibs.globalModel');
$globalModel = new globalModel();
?>

<script src="<?php echo $template_dir; ?>scripts/jScroll_1.js" type="text/javascript" ></script>
<script src="<?php echo $template_dir; ?>scripts/jScroll_2.js" type="text/javascript" ></script>
<script type="text/javascript">
    jQuery(document).ready(function(){
        jQuery('#pane').jScrollPane({scrollbarWidth: 20});
    });
</script>

<?php
if($_SERVER['HTTP_REFERER'] == '1'){
    $referer = $_SERVER['HTTP_REFERER'];    
}   
else{
    $referer = 'javascript:history.go(-1);';
} 

$menu_id = JRequest::getVar('Itemid', 0, 'get');
$sec_id = JRequest::getVar('section_id', 0, 'get'); 
$cat_id = JRequest::getVar('category_id', 0, 'get');
$layout = JRequest::getVar('layout', 0, 'get');
$emulate = JRequest::getVar('emulate', 0, 'get');
$current_id = JRequest::getVar('id', 0, 'get'); 

//$menu = $globalModel->getMenu($menu_id);
$menus = &JSite::getMenu();                                             
$menu  = $menus->getActive();   
$ignore = isset($menu->query['id']) ? $menu->query['id'] : -1;        
$sub_menus = $menus->getItems('parent', $menu->tree[0]);

$title = !$emulate ? $menu->name : $this->escape($this->article->title);
$doc =& JFactory::getDocument();
$doc->setTitle($title);
?>

<div id="main" class="p15t">
    <div class="w214 float_left">
        <div class="w214 left_menu m10b">
            <!-- Menu -->
            <div class="left_menu">
                <?php echo $globalModel->renderSubmenus($menu_id, $sec_id, $cat_id, $ignore, 1); ?> 
                
                <?php if(1==0){ ?>
                <!--{mo dule OnlineSupport}-->
                <ul class="parent_menu">    
                    <?php foreach($sub_menus as $child_menu){ ?>
                        <?php if($child_menu->id == $menu_id){ ?>
                            <li class="curr_left_menu">                                    
                                <a href="javascript:void(0);"><?php echo $menu->name; ?></a> 
                                <ul class="child_menu">                                
                                    <?php 
                                    $layout = $layout ? '&layout=' . $layout : '';                            
                                    if($sec_id){
                                        $sub_menu = $globalModel->getContentItems($sec_id, $cat_id, $ignore);
                                        $sec_id = '&section_id=' . $sec_id;
                                    }
                                    else{
                                        $sub_menu = $globalModel->getContentByCategory($cat_id, $ignore);
                                        $sec_id = '';
                                    }
                                    foreach($sub_menu as $key => $value ){                                  
                                        //$selected = $current_id == $value['id'] ? ' class="active"'   : '';                                
                                        $current  = $current_id == $value['id'] ? ' class="curr_sub"' : '';
                                        $link = 'index.php?option=com_content&view=article&id=' . $value['id'] . $layout . '&category_id=' . $cat_id . $sec_id . '&Itemid=' . $menu_id . '&emulate=1';
                                        ?>    
                                        <li<?php //echo $selected; ?>>
                                            <a <?php echo $current; ?> href="<?php echo $link; ?>" ><?php echo $value['title'];?></a>
                                        </li>                  
                                    <?php } ?> 
                                </ul>
                            </li> 
                        <?php }else{ ?>
                            <li class="curr_left_menu">
                                <a href="<?php echo $child_menu->link; ?>"><?php echo $child_menu->name; ?></a>
                            </li>
                        <?php } ?>    
                    <?php } ?> 
                </ul>
                <?php } ?>
            </div>
            <div class="left_menu_bot"></div>
        </div>
        
        <!-- Book -->
        <div class="w214 po m10b"> 
            <?php $link = $globalModel->getLeftColumnBookLink(); ?>
            <a href="<?php echo $link; ?>"><img src="<?php echo $template_dir; ?>images/book_banner.png" alt="" /></a>                        
        </div>
        
        <!-- News -->
        <div class="w214">
            <div class="ads_sub_top"></div>
            <div class="ads_sub_mid">
                <div class="w186 mc p10t p10b">
                    <?php                 
                    // Intel Inside   
                    $item = $globalModel->getLeftColumnArticleItem();                    
                    $text = strip_tags($item['introtext']);
                    $text = strlen($text) > 100 ? mb_substr($text, 0, 100, 'UTF-8') : $text;
                    $link = $globalModel->getLeftColumnArticleLink($item['id']);
                    ?> 
                    <?php if(1==0){ ?>
                    <a href="<?php echo $link; ?>"><img src="<?php echo $template_dir; ?>images/banner_ads_sub.jpg" alt="<?php echo $item['title'];?>" /></a>
                    <?php } ?>
                    <a href="<?php echo $link; ?>"><img src="<?php echo $item['article_image']; ?>" alt="<?php echo $item['title'];?>" /></a>                    
                    <p class="p5t"><?php echo $text; ?>...<a href="<?php echo $link; ?>"><?php echo JText::_('READ_MORE'); ?></a></p>
                </div>
            </div>
            <div class="ads_sub_bot"></div>
        </div>
    </div>
    
    <!-- Body -->
    <div class="float_left w736 bg_left_col2">
        <div class="w480 float_left p22l">
            <div class="w480 bg_tt_sub1 p10t">
                <h2 class="p5t float_left"><?php echo !$emulate ? $menu->name : $this->escape($this->article->title); ?></h2>
                <p class="float_right p5t" style="display:none"><a href="<?php echo $referer; ?>"><img src="<?php echo $template_dir; ?>images/tilbage_icon.png" alt="" /> Tilbage</a></p>
                <br style="clear:both" />
            </div>
            <div class="w480">
                <?php if($this->article->article_image != '') { ?>
                    <img src="<?php echo $this->article->article_image ; ?>" alt="<?php echo $this->escape($this->article->title); ?>" class="float_left m10r m10b"/>
                <?php } ?>
                <?php echo $this->article->text; ?>
            </div>
        </div>      
        
        <!-- Right -->
        <div class="w214 float_right">
            <!-- Contact -->
            <div class="b_top_box_right upper organ_text"><h2><?php echo JText::_('CONTACT_US'); ?></h2></div>
            <div class="b_middle_box_right">
                <?php if($this->article->benefit_image){ ?>
                    <p><img src="<?php echo $this->article->benefit_image; ?>" width="202" height="114" /></p>
                <?php } ?>    
                <?php 
                $contact = $this->article->parameters->get('benefit_contact');
                $address = $this->article->parameters->get('benefit_address');
                $phone   = $this->article->parameters->get('benefit_phone'); 
                if($contact != '' || $address != '' || $phone != ''){
                ?>        
                    <ul>
                        <li>
                            <?php echo $contact; ?><br />
                            <?php echo $address; ?><br />
                            <?php echo $phone; ?>
                        </li>
                    </ul>
                <?php } ?>
            </div>
            <div class="b_bottom_box_right"></div>
            
            <!-- Datalab download -->
            <?php                 
            // Datalab download   
            //$item = $globalModel->getArticleItem(101);              
            $link = '#';
            //if($item['article_image']){
            $src = $this->article->benefit_image1 ? $this->article->benefit_image1 : $template_dir . 'images/b_banner_download.png';
            ?> 
            <div class="p10t"> 
                <!--
                <a href="<?php echo $link; ?>">
                    <img src="<?php echo $src; ?>" alt="" width="214" height="113" />            
                </a>
                -->
                <img src="<?php echo $src; ?>" alt="" width="214" height="113" />            
            </div>
            <?php //} ?>
            
            <!-- Reference -->
            <?php  if(1==0){               
            // Reference              
            $item = $globalModel->getArticleItem(102);  
            $text = strip_tags($item['introtext']);
            $text = strlen($text) > 120 ? mb_substr($text, 0, 120, 'UTF-8') : $text;
            $link = $globalModel->getLeftColumnArticleLink($item['id']);   
            ?> 
            <div class="p10t">
                <div class="b_top_box_right upper organ_text"><h2><?php echo JText::_('REFERENCE'); ?></h2></div>
                <div class="b_middle_box_right"> 
                    <div class="mc">
                        <?php if($item['article_image']){  ?>
                            <img src=<?php echo $item['article_image'] ;?> alt="" class="float_left m5r m5b" width="79" height="79" />
                        <?php }  ?>
                        <?php echo $text; ?>
                        ...<span class="more"><a href="<?php echo $link; ?>"><?php echo JText::_('READ_MORE'); ?></a></span></div>
                </div>
                <div class="b_bottom_box_right"></div>
            </div>
            <?php } ?>
        </div>
        <div class="cb"></div>
        
        <div class="w707 p15t p22l">      
            <?php                      
            $sub_cat_id = $this->article->parameters->get('benefit_download_cat', -1); 
            $sub_articles = $globalModel->getContentByCategory($sub_cat_id, 0);  
            foreach($sub_articles as $article){  
                $text = strlen($article['introtext']) > 120 ? mb_substr($article['introtext'], 0, 120, 'UTF-8') : $article['introtext'];
                $link = $globalModel->getLeftColumnArticleLink($article['id']); 
                $download = trim($article['benefit_link']) <> '' ? $article['benefit_link'] : '#';
            ?>
                <div class="w707">
                    <div class="w707 b1pxt">
                        <?php if($article['benefit_image']){ ?>                              
                            <div class="image_pro float_left"><a href="<?php echo $link ?>"><img alt="" src="<?php echo $article['benefit_image'] ;?>"></a></div>
                        <?php } ?>
                        <?php $float_download = $article['benefit_image'] ? 'float_right' : ''; ?>
                        <div class="w547 <?php echo $float_download; ?>">
                            <b><?php echo $article->title; ?></b>
                            <p class="p2t"><?php echo $text; ?><span class="more"><a href="<?php echo $link ?>"><?php echo JText::_('READ_MORE'); ?></a></span></p>
                            <div class="w547 p5t">
                                <div class="down_css"><a href="<?php echo $download ?>"><b><?php echo JText::_('DOWNLOAD'); ?></b></a></div>
                            </div>
                        </div>
                        <div class="cb"></div>
                    </div>                 
                </div>
            <?php } ?>  
              
      </div>
      <div class="cb"></div>  
    </div>
</div>

<div id="footer" class="bg_foot_sub">
<!-- 
    <embed src="<?php //echo $this->baseurl; ?>/media/music/funktionstast_logolyd_2sek.mp3" autostart="true" loop="false" hidden="true" volume="10"> </embed>
 -->    
    <div class="w950 mc p15t p15b">
        <p class="float_left">Copyright © <?php echo date('Y'); ?> <a href="<?php echo $this->baseurl; ?>">CAREITEC.DK</a>. All rights reserved.</p>
        <p class="float_right">Design by <a href="http://www.mywebcreations.dk/" target="_blank">My Web Creations</a></p>
        <br style="clear:both" />
    </div>
</div>
</div>
</div>
